package docxtoexcel;

import org.apache.poi.POIXMLDocument;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.xwpf.extractor.XWPFWordExtractor;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFParagraph;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class Test {
    public static void main(String[] args) throws IOException {
        //读取文件路径
        OPCPackage opcPackage;
        opcPackage = POIXMLDocument.openPackage("E:/job/tmp/基于感知不均衡分析接口文档.docx");
        XWPFDocument xwpf = new XWPFDocument(opcPackage);

        List<XWPFParagraph> paragraphs = xwpf.getParagraphs();
        for (int i = 0; i < paragraphs.size(); i++) {
            String text = paragraphs.get(i).getText();
            System.out.println(text);
        }
    }
}
